#pragma once

#include <QObject>
#include "ui_kmainwindow.h"
#include "qmediaplayer.h"
#include "qmediaplaylist.h"


class PlayerController  : public QObject
{
	Q_OBJECT

public:
	PlayerController(Ui::KMainWindowClass& ui,QObject *parent = Q_NULLPTR);
	~PlayerController();
    


    QMediaPlayer::State getState() const;
    //bool isMuted() const;
    //qreal playbackRate() const;

public slots:
    void setState(QMediaPlayer::State state);
    void setVolume(int volume);
    void setMuted(bool muted);
    void setPlaylistMode(QMediaPlaylist::PlaybackMode mode);
    //void setPlaybackRate(float rate);

signals:
    void play();
    void pause();
    void stop();
    void next();
    void previous();
    void changeVolume(int volume);
    void changeMuting(bool muting);
    void changeRate(qreal rate);
    void changePlaylistMode(QMediaPlaylist::PlaybackMode mode);

private slots:
    void playClicked();
    void muteClicked();
    void updateRate();
    void onVolumeSliderValueChanged(int value);
    void playlistModeBtnClicked();
private:

    QMediaPlayer::State m_playerState;
    QMediaPlaylist::PlaybackMode m_playlistMode;
    bool playerMuted;
	Ui::KMainWindowClass* m_ui;
};
